package com.jvtd.nettyim.im.server.handler;

import com.jvtd.nettyim.im.protocol.request.CreateGroupRequestPacket;
import com.jvtd.nettyim.im.util.SessionUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;

import java.util.List;

/**
 * @author Created by neal.zhang
 * @date 2020/6/1 - 12:51
 */
public class CreateGroupRequestHandler extends SimpleChannelInboundHandler<CreateGroupRequestPacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, CreateGroupRequestPacket msg) throws Exception {
        List<String> userIdList = msg.getUserIdList();
        ChannelGroup channels = new DefaultChannelGroup(ctx.executor());

        userIdList.forEach(u->{
            Channel channel = SessionUtil.getChannel(u);
            if (channel != null) {

            }
        });
    }
}
